// Name:                Mixins
//
// Description:         Pomelo-UI mixin
//
// - Box-Model
// - Typographic
// - Visual
// - CSS3 Vendor Prefixes - NOT RECOMMENDED, USE AutoPrefixer
// - Flex Box
// - Utilities
// - COMPONENTS
//
// =============================================================================

// =============================================================================
// Box Model
// =============================================================================

// Micro clear fix
// via: http://nicolasgallagher.com/micro-clearfix-hack/
@mixin clearfix() {
  &:before,
  &:after {
    content: " ";
    display: table;
  }

  &:after {
    clear: both;
  }
}

// Center-align a block level element
@mixin center-block() {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

// Sizing shortcuts
// -----------------------------------------------------------------------------
@mixin size($width, $height) {
  width: $width;
  height: $height;
}

@mixin square($size) {
  @include size($size, $size);
}

// Resize anything
// -----------------------------------------------------------------------------
@mixin resizable($direction) {
  resize: $direction; // Options: horizontal, vertical, both
  overflow: auto; // Safari fix
}

// Scrollable
// -----------------------------------------------------------------------------
// TODO: add scrollableX & scrollableY
@mixin scrollable() {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}


// =============================================================================
// Typographic
// =============================================================================

// Text overflow
// Requires inline-block or block for proper styling
// -----------------------------------------------------------------------------

@mixin text-overflow($display: block) {
  display: $display;
  word-wrap: normal; /* for IE */
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

// CSS image replacement
// via: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
// -----------------------------------------------------------------------------

@mixin text-hide() {
  font: unquote("0/0") a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}

// Line clamp
// http://dropshado.ws/post/1015351370/webkit-line-clamp
// -----------------------------------------------------------------------------

@mixin am-line-clamp($lines, $line-height: 1.3em) {
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $lines; // number of lines to show
  overflow: hidden;
  line-height: $line-height;
  max-height: $line-height * $lines;
}



// =============================================================================
// Visual
// =============================================================================

// WebKit-style focus
@mixin tab-focus() {
  // Default
  outline: thin dotted;
  // WebKit
  outline: 1px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}

// Single side border-radius
// -----------------------------------------------------------------------------
@mixin border-top-radius($radius) {
  border-top-right-radius: $radius;
   border-top-left-radius: $radius;
}

@mixin border-right-radius($radius) {
  border-bottom-right-radius: $radius;
     border-top-right-radius: $radius;
}

@mixin border-bottom-radius($radius) {
  border-bottom-right-radius: $radius;
  border-bottom-left-radius: $radius;
}

@mixin border-left-radius($radius) {
  border-bottom-left-radius: $radius;
     border-top-left-radius: $radius;
}

// Opacity
// -----------------------------------------------------------------------------
@mixin opacity($opacity) {
  opacity: $opacity;
}

// GRADIENTS
// -----------------------------------------------------------------------------

// Horizontal gradient, from left to right
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
@mixin gradient-horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
  background-image: -webkit-gradient(linear, $start-percent top, $end-percent top, from($start-color), to($end-color)); // Safari 4+, Chrome 2+
  background-image: -webkit-linear-gradient(left, color-stop($start-color $start-percent), color-stop($end-color $end-percent)); // Safari 5.1+, Chrome 10+
  background-image: -moz-linear-gradient(left, $start-color $start-percent, $end-color $end-percent); // FF 3.6+
  background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent); // Standard, IE10
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down
}

// Vertical gradient, from top to bottom
// Creates two color stops, start and end, by specifying a color and position for each color stop.
// Color stops are not available in IE9 and below.
@mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
  background-image: -webkit-gradient(linear, left $start-percent, left $end-percent, from($start-color), to($end-color)); // Safari 4+, Chrome 2+
  background-image: -webkit-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Safari 5.1+, Chrome 10+
  background-image: -moz-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // FF 3.6+
  background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent); // Standard, IE10
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down
}

@mixin gradient-directional($start-color: #555, $end-color: #333, $deg: 45deg) {
  background-repeat: repeat-x;
  background-image: -webkit-linear-gradient($deg, $start-color, $end-color); // Safari 5.1+, Chrome 10+
  background-image: -moz-linear-gradient($deg, $start-color, $end-color); // FF 3.6+
  background-image: linear-gradient($deg, $start-color, $end-color); // Standard, IE10
}

@mixin gradient-horizontal-3c($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
  background-image: -webkit-gradient(left, linear, 0 0, 0 100%, from($start-color), color-stop($color-stop, $mid-color), to($end-color));
  background-image: -webkit-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
  background-image: -moz-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
  background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
  background-repeat: no-repeat;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down, gets no color-stop at all for proper fallback
}

@mixin gradient-vertical-3c($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from($start-color), color-stop($color-stop, $mid-color), to($end-color));
  background-image: -webkit-linear-gradient($start-color, $mid-color $color-stop, $end-color);
  background-image: -moz-linear-gradient(top, $start-color, $mid-color $color-stop, $end-color);
  background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
  background-repeat: no-repeat;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback
}

//放射状
@mixin gradient-radial($inner-color: #555, $outer-color: #333) {
  background-image: -webkit-gradient(radial, center center, 0, center center, 460, from($inner-color), to($outer-color));
  background-image: -webkit-radial-gradient(circle, $inner-color, $outer-color);
  background-image: -moz-radial-gradient(circle, $inner-color, $outer-color);
  background-image: radial-gradient(circle, $inner-color, $outer-color);
  background-repeat: no-repeat;
}

@mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) {
  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, $color), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, $color), color-stop(.75, $color), color-stop(.75, transparent), to(transparent));
  background-image: -webkit-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  background-image: -moz-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
}

// Legacy aliases
#gradient {
  @mixin horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
    @include gradient-horizontal($start-color, $end-color, $start-percent, $end-percent);
  }

  @mixin vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
    @include gradient-vertical($start-color, $end-color, $start-percent, $end-percent);
  }

  @mixin directional($start-color: #555, $end-color: #333, $deg: 45deg) {
    @include gradient-directional($start-color, $end-color, $deg);
  }

  @mixin horizontal-3c($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
    @include gradient-horizontal-3c($start-color, $mid-color, $color-stop, $end-color);
  }

  @mixin vertical-3c($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
    @include gradient-vertical-3c($start-color, $mid-color, $color-stop, $end-color);
  }

  //放射状
  @mixin radial($inner-color: #555, $outer-color: #333) {
    @include gradient-radial($inner-color, $outer-color);
  }

  @mixin striped($color: rgba(255,255,255,.15), $angle: 45deg) {
    @include gradient-striped($color, $angle);
  }
}

// Reset filters for IE
//
// When you need to remove a gradient background, do not forget to use this to
// reset the IE filter for IE9 and below.
// -----------------------------------------------------------------------------

@mixin reset-filter() {
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}


// Retina images
// Short retina mixin for setting background-image and -size
// -----------------------------------------------------------------------------
@mixin retina-bg-img($file-1x, $file-2x, $width-1x, $height-1x) {
  background-image: url("#{$file-1x}");
  @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
    background-image: url("#{$file-2x}");
    background-size: $width-1x $height-1x;
  }
}

// Responsive image
// Keep images from scaling beyond the width of their parents.
// -----------------------------------------------------------------------------
@mixin img-responsive($display: block) {
  display: $display;
  max-width: 100%; // Part 1: Set a maximum relative to the parent
  height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
}



// =============================================================================
// CSS3 Vendor Prefixes
// =============================================================================

// Try to use Autoprefixer replace these mixins

// - Animations
// - Backface visibility
// - Box shadow
// - Box sizing
// - Content columns
// - Hyphens
// - Placeholder text
// - Transformations
// - Transitions
// - User Select


// Animations
// -----------------------------------------------------------------------------
@mixin animation($animation) {
  -webkit-animation: $animation;
  animation: $animation;
}
@mixin animation-name($name) {
  -webkit-animation-name: $name;
  animation-name: $name;
}

@mixin animation-duration($duration) {
  -webkit-animation-duration: $duration;
  animation-duration: $duration;
}

@mixin animation-timing-function($timing-function) {
  -webkit-animation-timing-function: $timing-function;
  animation-timing-function: $timing-function;
}

@mixin animation-delay($delay) {
  -webkit-animation-delay: $delay;
  animation-delay: $delay;
}

@mixin animation-iteration-count($iteration-count) {
  -webkit-animation-iteration-count: $iteration-count;
  animation-iteration-count: $iteration-count;
}

@mixin animation-direction($direction) {
  -webkit-animation-direction: $direction;
  animation-direction: $direction;
}

@mixin animation-fill-mode($fill-mode) {
  -webkit-animation-fill-mode: $fill-mode;
  animation-fill-mode: $fill-mode;
}


// Backface visibility
// Prevent browsers from flickering when using CSS 3D transforms.
// Default value is `visible`, but can be changed to `hidden`
// -----------------------------------------------------------------------------
@mixin backface-visibility($visibility) {
  -webkit-backface-visibility: $visibility;
  -moz-backface-visibility: $visibility;
  backface-visibility: $visibility;
}


// Box shadows
// -----------------------------------------------------------------------------

@mixin box-shadow($shadow) {
  -webkit-box-shadow: $shadow; // iOS <4.3 & Android <4.1 & bb7.0
  box-shadow: $shadow;
}


// Box sizing
// -----------------------------------------------------------------------------
@mixin box-sizing($boxmodel) {
  -webkit-box-sizing: $boxmodel;
  -moz-box-sizing: $boxmodel;
  box-sizing: $boxmodel;
}


// Content Columns
// -----------------------------------------------------------------------------
@mixin content-columns($column-count, $column-gap: $grid-gutter-width) {
  -webkit-column-count: $column-count;
  -moz-column-count: $column-count;
  column-count: $column-count;
  -webkit-column-gap: $column-gap;
  -moz-column-gap: $column-gap;
  column-gap: $column-gap;
}


// Optional hyphenation
// -----------------------------------------------------------------------------
@mixin hyphens($mode: auto) {
  word-wrap: break-word;
  -webkit-hyphens: $mode;
  -moz-hyphens: $mode;
  -ms-hyphens: $mode; // IE10+
  -o-hyphens: $mode;
  hyphens: $mode;
}


// Placeholder text
// -----------------------------------------------------------------------------
@mixin placeholder($color: $input-color-placeholder) {
  // Firefox
  &::-moz-placeholder {
    color: $color;
    opacity: 1;
  }

  // Internet Explorer 10+
  &:-ms-input-placeholder {
    color: $color;
  }

  // Safari and Chrome
  &::-webkit-input-placeholder {
    color: $color;
  }
}


// Transformations
// -----------------------------------------------------------------------------

@mixin scale($ratio) {
  -webkit-transform: scale($ratio);
  -ms-transform: scale($ratio); // IE9 only
  -o-transform: scale($ratio);
  transform: scale($ratio);
}
@mixin scale($ratioX, $ratioY) {
  -webkit-transform: scale($ratioX, $ratioY);
  -ms-transform: scale($ratioX, $ratioY); // IE9 only
  -o-transform: scale($ratioX, $ratioY);
  transform: scale($ratioX, $ratioY);
}
@mixin scaleX($ratio) {
  -webkit-transform: scaleX($ratio);
  -ms-transform: scaleX($ratio); // IE9 only
  -o-transform: scaleX($ratio);
  transform: scaleX($ratio);
}
@mixin scaleY($ratio) {
  -webkit-transform: scaleY($ratio);
  -ms-transform: scaleY($ratio); // IE9 only
  -o-transform: scaleY($ratio);
  transform: scaleY($ratio);
}

@mixin skew($x, $y) {
  -webkit-transform: skew($x, $y);
  -ms-transform: skewX($x) skewY($y); // IE9+
  transform: skew($x, $y);
}

@mixin translate($x: 0, $y: 0) {
  -webkit-transform: translate($x, $y);
  -ms-transform: translate($x, $y); // IE9+
  transform: translate($x, $y);
}

@mixin translateX($x: 0) {
  -webkit-transform: translateX($x);
  -ms-transform: translateX($x); // IE9+
  transform: translateX($x);
}

@mixin translateY($y: 0) {
  -webkit-transform: translateY($y);
  -ms-transform: translateY($y); // IE9+
  transform: translateY($y);
}

@mixin translate3d($x:0, $y:0, $z:0) {
  -webkit-transform: translate3d($x,$y,$z);
  -ms-transform: translate3d($x,$y,$z);
  transform: translate3d($x,$y,$z);
}

@mixin rotate($degrees) {
  -webkit-transform: rotate($degrees);
  -ms-transform: rotate($degrees); // IE9+
  transform: rotate($degrees);
}

@mixin rotateX($degrees) {
  -webkit-transform: rotateX($degrees);
  -ms-transform: rotateX($degrees); // IE9+
  transform: rotateX($degrees);
}

@mixin rotateY($degrees) {
  -webkit-transform: rotateY($degrees);
  -ms-transform: rotateY($degrees); // IE9+
  transform: rotateY($degrees);
}

@mixin perspective($perspective) {
  -webkit-perspective: $perspective;
  -moz-perspective: $perspective;
  perspective: $perspective;
}

@mixin perspective-origin($perspective) {
  -webkit-perspective-origin: $perspective;
  -moz-perspective-origin: $perspective;
  perspective-origin: $perspective;
}

@mixin transform-origin($origin) {
  -webkit-transform-origin: $origin;
  -ms-transform-origin: $origin;
  transform-origin: $origin;
}

@mixin transform($tramsform) {
  -webkit-transform: $tramsform;
  -ms-transform: $tramsform;
  transform: $tramsform;
}

// Transitions
// -----------------------------------------------------------------------------
@mixin transition($transition) {
  -webkit-transition: $transition;
  transition: $transition;
}

@mixin transition-property($transition-property) {
  -webkit-transition-property: $transition-property;
  transition-property: $transition-property;
}

@mixin transition-delay($transition-delay) {
  -webkit-transition-delay: $transition-delay;
  transition-delay: $transition-delay;
}

@mixin transition-duration($transition-duration) {
  -webkit-transition-duration: $transition-duration;
  transition-duration: $transition-duration;
}

@mixin transition-timing-function($timing-function) {
  -webkit-transition-timing-function: $timing-function;
  transition-timing-function: $timing-function;
}

@mixin transition-transform($transition) {
  -webkit-transition: -webkit-transform $transition;
  -moz-transition: -moz-transform $transition;
  -o-transition: -o-transform $transition;
  transition: transform $transition;
}


// User select
// For selecting text on the page
// Formal syntax: none | text | all | element
// -----------------------------------------------------------------------------
@mixin user-select($select) {
  -webkit-user-select: $select;
  -moz-user-select: $select;
  -ms-user-select: $select; // IE10+
  user-select: $select;
}



// =============================================================================
// Flexbox
// =============================================================================

// The spec: http://www.w3.org/TR/css3-flexbox
// via: https://gist.github.com/jayj/4012969
//      https://github.com/mastastealth/sass-flex-mixin/blob/master/flex.scss
//      http://codepen.io/adamjohnson/pen/savzI
//      http://css-tricks.com/old-flexbox-and-new-flexbox/
//      http://html5please.com/#flexbox
//
// NOTE: NEED CODE REVIEW
// -----------------------------------------------------------------------------

// Flexbox display
// flex | inline-flex
@mixin flexbox($display: flex) {
  display: -webkit-box; // Old syntax
  display: unquote("-webkit-#{$display}");
  display: unquote("-moz-#{$display}");
  display: unquote("-ms-#{$display}box"); // IE10 uses -ms-flexbox
  display: unquote("-ms-#{$display}"); // IE11
  display: $display;
}

// The 'flex' shorthand
// This shorthand for `flex-grow`, `flex-shrink` and `flex-basis` combined.
// The second and third parameters (flex-shrink and flex-basis) are optional.
// Default is 0 1 auto.
// - applies to: flex items
// <positive-number>, initial, auto, or none
@mixin flex($columns: 1) {
  -webkit-box-flex: $columns; // Old syntax
  -webkit-flex: $columns;
  -moz-flex: $columns;
  -ms-flex: $columns;
  flex: $columns;
}

// Flex Flow Direction
// - applies to: flex containers
// row | row-reverse | column | column-reverse
@mixin flex-direction($direction: row) {
  -webkit-flex-direction: $direction;
  -moz-flex-direction: $direction;
  -ms-flex-direction: $direction;
  flex-direction: $direction;
}

// Flex Line Wrapping
// - applies to: flex containers
// nowrap | wrap | wrap-reverse
@mixin flex-wrap($wrap: nowrap) {
  -webkit-flex-wrap: $wrap;
  -moz-flex-wrap: $wrap;
  -ms-flex-wrap: $wrap;
  flex-wrap: $wrap;
}

// Flex Direction and Wrap
// The shorthand for `flex-direction` and `flex-wrap`
// - applies to: flex containers
// <flex-direction> || <flex-wrap>
@mixin flex-flow($flow: unquote("row nowrap")) {
  -webkit-flex-flow: $flow;
  -moz-flex-flow: $flow;
  -ms-flex-flow: $flow;
  flex-flow: $flow;
}

// Axis Alignment
// - applies to: flex containers
// flex-start | flex-end | center | space-between | space-around
@mixin justify-content($justify: flex-start) {
  -webkit-justify-content: $justify;
  -moz-justify-content: $justify;
  -ms-justify-content: $justify;
  justify-content: $justify;
}

// Packing Flex Lines
// - applies to: multi-line flex containers
// flex-start | flex-end | center | space-between | space-around | stretch
@mixin align-content($align: stretch) {
  // http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack
  -webkit-box-pack: $align; // Old syntax: start | end | center | justify | distribute
  -webkit-align-content: $align;
  -moz-align-content: $align;
  -ms-align-content: $align;
  align-content: $align;
}

// Cross-axis Alignment
// - applies to: flex containers
// flex-start | flex-end | center | baseline | stretch
@mixin align-items($align: stretch) {
  // start | center | end | baseline | stretch
  -webkit-box-align: $align;  // Old syntax
  -webkit-align-items: $align;
  -moz-align-items: $align;
  -ms-align-items: $align;
  align-items: $align;
}

// Display Order
// - applies to: flex items
// <integer>
@mixin flex-order($order: 0) {
  -webkit-flex-order: $order; // Old syntax
  -webkit-order: $order;
  -moz-order: $order;
  -ms-order: $order;
  order: $order;
}

// Flex grow factor
// - applies to: flex items
// <number>
@mixin flex-grow($grow: 0) {
  -webkit-flex-grow: $grow;
  -moz-flex-grow: $grow;
  -ms-flex-grow: $grow;
  flex-grow: $grow;
}

// Flex shr
// - applies to: flex itemsink factor
// <number>
@mixin flex-shrink($shrink: 1) {
  -webkit-flex-shrink: $shrink;
  -moz-flex-shrink: $shrink;
  -ms-flex-shrink: $shrink;
  flex-shrink: $shrink;
}

// Flex basis
// - the initial main size of the flex item
// - applies to: flex itemsnitial main size of the flex item
// <width>
@mixin flex-basis($width: auto) {
  -webkit-flex-basis: $width;
  -moz-flex-basis: $width;
  -ms-flex-basis: $width;
  flex-basis: $width;
}

// Cross-axis Alignment
// - applies to: flex items
// auto | flex-start | flex-end | center | baseline | stretch
@mixin align-self($align: auto) {
  -webkit-align-self: $align;
  -moz-align-self: $align;
  -ms-align-self: $align;
  align-self: $align;
}



// =============================================================================
// Caret
// NOTE: If using ::before or ::after, `content: ""` is required
// =============================================================================

// Caret - down
// -----------------------------------------------------------------------------
@mixin caret-down($size: 6px, $color:#222) {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: middle;
  border-top: $size solid $color;
  border-right: $size solid transparent;
  border-left: $size solid transparent;
  border-bottom: 0 dotted;
  transform: rotate(360deg);
}

// Caret - up
// -----------------------------------------------------------------------------
@mixin caret-up($size:6px, $color:#222) {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: middle;
  border-bottom: $size solid $color;
  border-right: $size solid transparent;
  border-left: $size solid transparent;
  border-top: 0 dotted;
  transform: rotate(360deg);
}

// Caret - left
// -----------------------------------------------------------------------------
@mixin caret-left($size:6px, $color:#222) {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: middle;
  border-right: $size solid $color;
  border-top: $size solid transparent;
  border-bottom: $size solid transparent;
  border-left: 0 dotted;
  transform: rotate(360deg);
}

// Caret - right
// -----------------------------------------------------------------------------
@mixin caret-right($size:6px, $color:#222) {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: middle;
  border-left: $size solid $color;
  border-top: $size solid transparent;
  border-bottom: $size solid transparent;
  border-right: 0 dotted;
  transform: rotate(360deg);
}


// CSS Arrow Mixin
// -----------------------------------------------------------------------------
//
// $param:  45deg (default) - right
//          135deg - down
//          -45deg - up
//          -135deg -left
// ------------------------------------------------------------------------

@mixin arrow($color:#DDD, $width:6px, $border-width: 2px, $deg: 45deg) {
  display: inline-block;
  width: $width;
  height: $width;
  border: $color solid;
  border-width: $border-width $border-width 0 0;
  transform: rotate($deg);
}



// =============================================================================
// COMPONENT MIXINS
// =============================================================================

// Button variants
// =============================================================================

@mixin button-variant($color, $background, $border) {
  color: $color;
  background-color: $background;
  border-color: $border;

  /*a&:visited {
    color: $color;
  }*/

  &:hover,
  &:focus,
  &:active,
  &.#{$ns}active,
  .#{$ns}active &.#{$ns}dropdown-toggle {
    color: $color;
    border-color: darken($border, 12%);
  }

  &:hover,
  &:focus {
    background-color: darken($background, 7%);
  }

  &:active,
  &.#{$ns}active,
  .#{$ns}active &.#{$ns}dropdown-toggle {
    background-image: none;
    background-color: darken($background, 14%);
  }

  &.#{$ns}disabled,
  &[disabled],
  fieldset[disabled] & {
    &,
    &:hover,
    &:focus,
    &:active,
    &.#{$ns}active {
      background-color: $background;
      border-color: $border;
    }
  }

  // for `.#{$ns}btn-group`
  .#{$ns}btn-group &,
  .#{$ns}btn-group-stacked & {
    border-color: darken($background, 5%);
  }
}

// Button size
// -----------------------------------------------------------------------------

@mixin button-size($font-size) {
  font-size: $font-size;
  // line-height: ensure proper height of button next to small input
  // line-height: $line-height;
}

// Form
// =============================================================================

// Form validation states
// -----------------------------------------------------------------------------
@mixin form-field-validation($text-color: #555, $border-color: #ccc) {
  // the label and help text color
  .#{$ns}form-help,
  .am-form-label,
  .am-radio,
  .am-checkbox,
  .am-radio-inline,
  .am-checkbox-inline,
  label {
    color: $text-color;
  }

  // feedback icon
  [class*="icon-"] {
    color: $text-color;
  }
}

@mixin form-field-validation-filed($text-color: #555, $border-color: #ccc) {
    border-color: $border-color !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
    &:focus {
      //background-color: rgba(red($border-color), green($border-color), blue($border-color), .05) !important;
      background-color: $input-focus-bg;
      border-color: darken($border-color, 10%);
      $shadow:  inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 5px lighten($border-color, 20%) !important !default;
      box-shadow: $shadow !important;
    }
}


// Form element focus state
// -----------------------------------------------------------------------------
@mixin form-field-focus($color: $input-border-focus) {
  $color-rgba:  rgba(red($color), green($color), blue($color), .3) !default;
  &:focus {
    //background-color: rgba(red($color), green($color), blue($color), .05);
    background-color: $input-focus-bg;
    border-color: $color;
    outline: 0;
    box-shadow: unquote("inset 0 1px 1px rgba(0,0,0,.075), 0 0 5px #{$color-rgba}");
  }
}

// Grid
// =============================================================================
@mixin grid-container($gutter: $grid-gutter, $gutter-md: $grid-gutter-md, $max-width: $grid-max-width) {
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  padding-left: $gutter;
  padding-right: $gutter;
  width: 100%;
  max-width: $max-width;
  @include clearfix;

  @media #{$medium-up} {
    padding-left: $gutter-md;
    padding-right: $gutter-md;
  }
}

// Font ICON mixin
// =============================================================================
// 1. Allow margin
// 2. Prevent inherit font style
// 3. Align vertical to text
// 4. Correct line-height
// 5. Better font rendering in Webkit
@mixin am-icon-font() {
  display: inline-block; // 1
  font: normal normal normal $global-font-size/1 "FontAwesome", sans-serif; // shortening font declaration
  /*font-weight: normal; // 2
  font-style: normal; // 2
  vertical-align: baseline; // 3
  line-height: 1; // 4*/
  font-size: inherit; // can't have font-size inherit on line above, so need to override
  text-rendering: auto; // optimizelegibility throws things off #1094
  -webkit-font-smoothing: antialiased; // 5
  -moz-osx-font-smoothing: grayscale;
  transform: translate(0, 0); // ensures no half-pixel rendering in firefox
}


// angle
// =============================================================================
// TODO: 分隔成小块

@mixin angle-base() {
  &:before,
  &:after {
    position: absolute;
    display: block;
    content: "";
    width: 0;
    height: 0;
    border: 8px dashed transparent;
    z-index: 1;
  }
}

@mixin angle-up-variant($border-color: #ddd, $bg-color: #fff, $border-width: 8px) {
  &:before,
  &:after {
    border-bottom-style: solid;
    border-width: 0 $border-width $border-width;
  }

  &:before {
    border-bottom-color: $border-color;
    bottom: 0;
  }

  &:after {
    border-bottom-color: $bg-color;
    bottom: -1px;
  }
}

@mixin angle-down-variant($border-color: #ddd, $bg-color: #fff, $border-width: 8px) {
  bottom: -($border-width + 1);

  &:before,
  &:after {
    border-top-style: solid;
    border-width: $border-width $border-width 0;
  }

  &:before {
    border-top-color: $border-color;
    bottom: 0;
  }

  &:after {
    border-top-color: $bg-color;
    bottom: 1px;
  }
}

@mixin angle-left-variant($border-color: #ddd, $bg-color: #fff, $border-width: 8px) {
  left: -($border-width + 1);

  &:before,
  &:after {
    border-right-style: solid;
    border-width: $border-width $border-width $border-width 0;
  }

  &:before {
    border-right-color: $border-color;
    left: 0;
  }

  &:after {
    border-right-color: $bg-color;
    left: 1px;
  }
}

@mixin angle-right-variant($border-color: #ddd, $bg-color: #fff, $border-width: 8px) {
  right: 0;

  &:before,
  &:after {
    border-left-style: solid;
    border-width: $border-width 0 $border-width $border-width;
  }

  &:before {
    border-left-color: $border-color;
    left: 0;
  }

  &:after {
    border-left-color: $bg-color;
    left: -1px;
  }
}
